Declares and defines a subroutine in a DLL file that you want to execute from Office Basic.
Office Basic から実行する DLL ファイル内のサブルーチンの宣言と定義を行います。
See also: FreeLibrary
次も参照してください:FreeLibrary。
Declare {Sub | Function} Name Lib "Libname" [Alias "Aliasname"] [Parameter] [As Type]
Declare {Sub | Function} Name Lib "Libname" [Alias "Aliasname"] [Parameter] [As Type]
Name: A different name than defined in the DLL, to call the subroutine from Office Basic.
Name: Office Basic からサブルーチンを呼び出すための DLL 内の定義名とは異なる名前。
Aliasname: Name of the subroutine as defined in the DLL.
Aliasname:サブルーチンの DLL 内の定義名。
Libname: File or system name of the DLL. This library is automatically loaded the first time the function is used.
Libname: DLL のファイルないしシステム名このライブラリは、関数の初回使用時に自動的に読み込まれます。
Argumentlist: List of parameters representing arguments that are passed to the procedure when it is called. The type and number of parameters is dependent on the executed procedure.
Argumentlist: 呼び出し時にプロシージャーに渡される引数を示すパラメータのリストパラメータの種類と数は、実行するプロシージャーに依存します。
Type: Defines the data type of the value that is returned by a function procedure. You can exclude this parameter if a type-declaration character is entered after the name.
Type: 関数プロシージャーにより返される値のデータ型を指定します。名前の次に型宣言子を入力する場合、このパラメータは省略できます。
![]() | To pass a parameter to a subroutine as a value instead of as a reference, the parameter must be indicated by the keyword ByVal.
パラメータをサブルーチンに参照渡しでなく値渡しで与える場合、このパラメータは ByVal キーワードで指定する必要があります。 |
Declare Sub MyMessageBeep Lib "user32.dll" Alias "MessageBeep" ( long )
Declare Sub MyMessageBeep Lib "user32.dll" Alias "MessageBeep" ( long )
Sub ExampleDeclare
Sub ExampleDeclare
Dim lValue As Long
Dim lValue As Long
lValue = 5000
lValue = 5000
MyMessageBeep( lValue )
MyMessageBeep( lValue )
FreeLibrary("user32.dll" )
FreeLibrary("user32.dll" )
End Sub
End Sub